/*
 * Plugin Name: autoFit
 * Plugin URI: 
 * Description: Image auto resizer according to class name
 * Author: Sakib Iqbal
 * Author URI: http://www.sakibiqbal.com/
 * Author email: mail@sakibiqbal.com
 * Version: 0.1
*/

(function($) {

    $.fn.autoFit = function(Hval, Wval) {
	h = this.height;    // height of selected image
	w = this.width;     // width of selected image
	
	if(h>w){
		this.css('height', Hval).css('width', 'auto');
	}				
	else if(w>h){
		this.css('width', Wval).css('height', 'auto');						
	}
	else{
		if(Hval>Wval){
			this.css('width', Wval).css('height', 'auto');
		}
		else{
			this.css('height', Hval).css('width', 'auto');
		}
	}
    }
}(jQuery));

